﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Data;

namespace Hotel.UI.Converters
{
    public class Count2VisiblityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                if (value.IsNullAndTrimAndEmpty())
                    return Visibility.Collapsed;
                int.TryParse(value + "", out int stateCurrent);

                if (stateCurrent > 0)
                    return Visibility.Visible;
                return Visibility.Collapsed;

            }
            catch
            {

                return Visibility.Collapsed;
            }
            //  return DependencyProperty.UnsetValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}